package com.itheima.tcp.Demo2;

import java.io.*;
import java.net.Socket;

public class Client {
    public static void main(String[] args) throws IOException {
        Socket s = new Socket("127.0.0.1",10000);
        BufferedInputStream bis = new BufferedInputStream(new FileInputStream("test_网络编程入门\\1.jpg"));
        BufferedOutputStream bos = new BufferedOutputStream(s.getOutputStream());
        int b;
        while((b = bis.read())!=-1){
            bos.write(b);
        }
        bos.flush();
        s.shutdownOutput();

        BufferedReader br = new BufferedReader(new InputStreamReader(s.getInputStream()));
        String line;
        while((line = br.readLine())!=null){
            System.out.println(line);
        }
        s.close();
    }
}
